package ${packageName}.controller;

import top.xunfong.common.core.domain.R;
import top.xunfong.common.core.domain.TableDataInfo;
import top.xunfong.common.core.domain.dto.BatchDTO;
import ${packageName}.service.${service};
import ${packageName}.dto.${dto};
import ${packageName}.dto.${queryDTO};
import ${packageName}.vo.${vo};
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.xunfong.mybatis.core.page.PageDTO;

@RestController
@RequestMapping("/${variableName}")
public class ${controller} {

    @Autowired
    private ${service} ${variableName}Service;

    /**
     * 新增
     *
     * @param dto
     * @return
     */
    @PostMapping("/insert")
    public R<?> insert${className}(@RequestBody ${dto} dto) {
        return ${variableName}Service.insert${className}(dto);
    }


    /**
     * 修改
     *
     * @param dto
     * @return
     */
    @PostMapping("/update")
    public R<?> update${className}(@RequestBody ${dto} dto) {
        return ${variableName}Service.update${className}(dto);
    }

    /**
     * 批量删除
     *
     * @param dto
     * @return
     */
    @PostMapping("/delete")
    public R<?> delete${className}(@RequestBody BatchDTO<Long> dto) {
        return ${variableName}Service.delete${className}(dto);
    }

    /**
     * 列表查询
     *
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public TableDataInfo<${vo}> list${className}(@RequestBody ${queryDTO} dto, PageDTO pageDTO) {
        return ${variableName}Service.list${className}(dto, pageDTO);
    }

    @GetMapping("/single")
    public R<${vo}> single${className}(Long id) {
        return ${variableName}Service.single${className}(id);
    }
}